﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetDimension.NanUI.ResourceHandler;

namespace NetDimension.NanUI
{
    public static class ResourceHandlerRegister
    {
        /// <summary>
        /// 注册压缩包资源
        /// </summary>
        /// <param name="bs"></param>
        /// <param name="scheme">网络协议</param>
        /// <param name="domain">内部域名</param>
        /// <param name="zipPath">压缩包文件路径</param>
        /// <param name="enableCache">是否开启缓存</param>
        /// <param name="rootPath">压缩包里面的根目录</param>
        /// <returns></returns>
        public static Bootstrap UseZippedResource(this Bootstrap bs, ResourceHandlerScheme scheme, string domain, string zipPath, bool enableCache = false, string rootPath = "")
        {
            Bootstrap.RegisterCustomResourceHandler(() =>
            {
                return new ZippedResource(scheme, domain, zipPath, enableCache, rootPath);
            });
            return bs;
        }
    }
}
